package com.string.demo;


public class connectStringDemo {

    public static void main(String[] args) {

        int[] arr1 = {1, 2, 3};

        String s = arr2String(arr1);


    }

    public static String arr2String(int[] arr) {
      StringBuilder sb =   new StringBuilder();
        sb.append("[");
        for (int i = 0; i < arr.length; i++){
            if (i==arr.length-1){
                sb.append(arr[i]);
            }else {
                sb.append(arr[i]).append(",");
            }
        }
        sb.append("]");
        String s = sb.toString();
        System.out.println("s+-----"+s);
        return s;
    }


}
